/*
 * Минимаксимум
 * vim:fdm=marker:
 */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <assert.h>
#include <limits.h>
#include <ctype.h>

struct node {
	int *pval;
	struct mmheap *up, *left, *right;
};

struct data {
	int value;
	struct node *minheap, *maxheap;
};

struct mmheap {
	struct data *array;
	int n;
	struct node *minheap, *maxheap;
};

/*
 * Ghetto-code
 */

int
mmh_extractmin(struct mmheap *h)
{
}

int
mmh_extractmax(struct mmheap *h, const int val)
{
	h->array[h->n++].value = val;

}

void
mmh_insert(struct mmheap *h)
{
}

#define mmh_init(h, c) do {\
	break;\
} while (0)

#define mmh_destroy(h) do {\
	break;\
} while (0)

int
main(int argc, char **argv)
{
	struct minmaxheap h;
	char s[15];
	int n;
	int val;

	scanf("%d", &n);
	mmh_init(h, n + 1);

	while (scanf("%[^ \n\t]", s) == 1) {
		if (strcmp(s, "ExtractMin") == 0) {
			printf("%d\n", mmh_extractmin(&h));
		} else if (strcmp(s, "ExtractMax") == 0) {
			printf("%d\n", mmh_extractmax(&h));
		} else {
			val = atoi(strstr(s, "(") + 1);
			mmh_insert(&h, val);
		}
	}

	mmh_destroy(h);

	return 0;
}
